﻿
using ServerBase.Config;

namespace SvGame.Controller;

public partial class GameHandler
{
    /// <summary>
    /// 客户端调试
    /// </summary>
    /// <param name="pack"></param>
    public int C2GDebug(MyPackage pack)
    {
        pack.GetMsg(out C2GDebug req);
        var rsp = new G2CDebug();

        if (!pack.PackGetPlayer(out var player) || player is null)
        {
            return 0;
        }
        if (req.Args.Count <= 0)
        {
            return 0;
        }
        loger.Debug(Jsh.Jstr(req.Args));
        switch (req.Args[0])
        {
            case "full":
                player.Full();
                break;
            case "half":
                player.Half();
                break;
            case "empty":
                player.Empty();
                break;
            case "hunmi":
                player.Unconcious();
                break;
            case "die":
                player.Die();
                break;
            case "pot":
                player.Pot += 1000000;
                player.NtfPlayerInfo();
                break;
            case "cloneitem":
                if (req.Args.Count >= 2)
                {
                    player.AddItem(req.Args[1].ToInt(), 1);
                    player.NtfPlayerItems();
                }
                break;
            case "cloneequip":
                if (req.Args.Count >= 2)
                {
                    player.AddEquip(req.Args[1].ToInt(), 1);
                    player.NtfPlayerEquips();
                }
                break;
            case "变更门派":
                if (req.Args.Count >= 2)
                {
                    if (ConfFamily.ContainsKey(req.Args[1]))
                    {
                        player.Family = req.Args[1];
                        player.NtfPlayerPerform();
                    }
                }
                break;
            default:
                break;
        }

        return 0;
    }
}
